package com.computechinc.earthquake.client;

import java.util.Date;
import java.util.HashMap;

public class QuakeData {
	// Age constants
	public static final char HOUR = 'H';
	public static final char DAY = 'D';
	public static final char WEEK = 'W';
	public static final char MONTH = 'M';
	public static final char YEAR = 'Y';
	public static final HashMap<Character, String> ages = 
			new HashMap<Character, String>();
	static { 
		ages.put( HOUR, "Past hour" );
		ages.put( DAY, "Past day" );
		ages.put( WEEK, "Past week" );
		ages.put( MONTH, "Past month" );
		ages.put( YEAR, "Past year" );
	}
	
	// Data fields
	private String id = "";
	private String title = "";
	private Date updated = null;
	private String summary = "";
	private double lat = -1, lon = -1;
	private double elev = -1;
	private char age = ' ';
	
	public QuakeData( String id, String title, Date updated,
					  String summary, double lat, double lon,
					  double elev, char age ) {
		this.id = id;
		this.title = title;
		this.updated = updated;
		this.summary = summary;
		this.lat = lat;
		this.lon = lon;
		this.elev = elev;
		this.age = age;
	}
	
	/**
	 * @return the id
	 */
	public String getId() {
		return id;
	}

	/**
	 * @return the title
	 */
	public String getTitle() {
		return title;
	}

	/**
	 * @return the updated
	 */
	public Date getUpdated() {
		return updated;
	}

	/**
	 * @return the summary
	 */
	public String getSummary() {
		return summary;
	}

	/**
	 * @return the lat
	 */
	public double getLat() {
		return lat;
	}

	/**
	 * @return the lon
	 */
	public double getLon() {
		return lon;
	}

	/**
	 * @return the elev
	 */
	public double getElev() {
		return elev;
	}

	/**
	 * @return the age
	 */
	public char getAge() {
		return age;
	}

	/**
	 * @param id the id to set
	 */
	public void setId( String id ) {
		this.id = id;
	}

	/**
	 * @param title the title to set
	 */
	public void setTitle( String title ) {
		this.title = title;
	}

	/**
	 * @param updated the updated to set
	 */
	public void setUpdated( Date updated ) {
		this.updated = updated;
	}

	/**
	 * @param summary the summary to set
	 */
	public void setSummary( String summary ) {
		this.summary = summary;
	}

	/**
	 * @param lat the lat to set
	 */
	public void setLat( double lat ) {
		this.lat = lat;
	}

	/**
	 * @param lon the lon to set
	 */
	public void setLon( double lon ) {
		this.lon = lon;
	}

	/**
	 * @param elev the elev to set
	 */
	public void setElev( double elev ) {
		this.elev = elev;
	}

	/**
	 * @param age the age to set
	 */
	public void setAge( char age ) {
		this.age = age;
	}
	
	public String toString() {
		return "QuakeData= ID: " + id + ", Title: " + title + 
			   ", Updated: " + updated + ", Summary: " + summary + 
			   ", Point: " + lat + ", " +lon + ", Elevation: " + elev + 
			   ", Category (Age): " + age;
	}
}
